home *** CD-ROM | disk | FTP | other *** search
- Path: nntp.teleport.com!usenet
- From: GHouck <hksys@teleport.com>
- Newsgroups: comp.lang.c,comp.lang.c++
- Subject: Re: Help!! Allocating Memory
- Date: 20 Apr 1996 05:43:44 GMT
- Organization: systems hk
- Message-ID: <4l9tig$sq@nadine.teleport.com>
- References: <4l3i8a$6lu@news.ycc.yale.edu>
- NNTP-Posting-Host: ip-pdx18-35.teleport.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.22 (Windows; I; 32bit)
-
- ackerber@econ.yale.edu (Daniel Ackerberg) wrote:
- >Hi. I am a novice trying to run a C program with a large (~10 Meg) array
- >on a Sparc 20 running SunOS and with 64 Meg of RAM.
- >
- >The program essential calls a short (~1.5 second) function that runs
- >through and performs some operations on the 10 Meg array.
- >
- >My problem is that on starting the program, the "function" takes about
- >1.5 seconds for each evaluation. This continues for about 5-10 minutes.
- >Then, suddenly, after what seems to be a random amount of time or number
- >of evaluations, the function starts to take about 2.7 seconds per evaluation.
- >
- [snip]
-
- Daniel,
-
- Perhaps you do start swapping after all as the program progresses. For
- instance, each iteration of your outer loop requires the final 'printf'
- which may involve some more temporary allocation of buffers (or expansion
- thereof); this in turn might result in some of your original buffer 'x'
- being temporarily moved or swapped (depending on what type of memory
- it was: discardable, moveable, etc). Then when the i/o is completed,
- the original 'x' vector may be scattered about (the allocation isn't
- necessarily contiguous at the machine level, is it?) because it puts
- it back into another location. If I remember much about Windows memory
- allocation (as opposed to your environment), even though page faults may
- not appear necessary, the type of memory, its volatility, and its
- contiquity (sic), added to persistent additional allocations (i/o)
- might fragment it enough to start affecting performance. Just a thought.
-
- Yours, Geoff Houck
-
-